{namespace rb.menu.templates}


/**
 * Creates the admin menu.
 */
{template .adminMenu}
  <h3 class="{css nav-group-header}">Administer</h3>
  <ul class="{css nav-list}">
    <li><a href="#/admin/post">New Post</a></li>
    <li><a href="#/admin/members">Member Accounts</a></li>
  </ul>
{/template}


/**
 * Creates the Community menu to be displayed when the user is not logged in.
 */
{template .communityMenuNoUser}
  <h3 class="{css nav-group-header}">Community</h3>
  <ul class="{css nav-list}">
    <li id="auth-link"><a href="#/auth/login">Log in</a></li>
    <li><a href="#/members/profiles">Browse Member Profiles</a></li>
  </ul>
{/template}


/**
 * Creates the Community menu to be displayed when the user is logged in.
 * @param name The user's display name.
 */
{template .communityMenuUser}
  <h3 class="{css nav-group-header}">Community</h3>
  <ul class="{css nav-list}">
    <li id="auth-link"><a href="#/auth/logout">Log out ({$name})</a></li>
  </ul>
{/template}


/**
 * Creates the list of recent articles.
 * @param months An array of objects containing:
 *     month {string} The month and year
 *     posts {Array.<{{title: string, slug: string}}
           Array of post titles/slugs if current is true, then this is the
           post being displayed, and the link should be bold.
 */
{template .postList}
  {foreach $month in $months}
    <h4 class="{css nav-group-header}">{$month.month}</h4>
    {foreach $post  in $month.posts}
      <div class="{css page-nav-article-link}">
        <a href="#/post/{$post.slug|id}">
          {$post.title}
        </a>
      </div>
    {/foreach}
  {/foreach}
{/template}
